'use strict';
// http://stackoverflow.com/questions/19474712/mongoose-and-multiple-database-in-single-node-js-project

var mongoose = require('mongoose');

var conn1 = mongoose.createConnection('mongodb://localhost/testA');
var conn2 = mongoose.createConnection('mongodb://localhost/testB');

// stored in 'testA' database
var ModelA = conn1.model('Model', new mongoose.Schema({
	title: {
		type: String,
		default: 'model in testA database'
	}
}));

// stored in 'testB' database
var ModelB = conn2.model('Model', new mongoose.Schema({
	title: {
		type: String,
		default: 'model in testB database'
	}
}));
